import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'

export const layout_routes: RouteRecordRaw[] = [
  {
    path: '/home',
    name: 'Home',
    component: () => import(/* webpackChunkName: 'Home' */ '@/views/Home/indexView.vue'),
    meta: {
      title: '首页',
      iconName: 'home-o'
    }
  },
  {
    path: '/classify',
    name: 'Classify',
    component: () => import(/* webpackChunkName: 'Classify' */ '@/views/Classify/indexView.vue'),
    meta: {
      title: '分类',
      iconName: 'label-o'
    }
  }, 
  {
    path: '/Cart',
    name: 'Cart',
    component: () => import(/* webpackChunkName: 'Cart' */ '@/views/Cart/indexView.vue'),
    meta: {
      title: '购物车',
      iconName: 'cart-o'
    }
  }, 
  {
    path: '/My',
    name: 'My',
    component: () => import(/* webpackChunkName: 'My' */ '@/views/My/indexView.vue'),
    meta: {
      title: '我的',
      iconName: 'friends-o'
    }
  }
]

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'Layout',
    component: () => import(/* webpackChunkName: "layout" */ '@/layout/indexView.vue'),
    redirect: '/home',
    children: layout_routes
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import(/* webpackChunkName: "Login" */ '@/views/Login/indexView.vue')
  },
  {
    path: '/detail/:id',
    name: 'Detail',
    component: () => import(/* webpackChunkName: "Detail" */ '@/views/Detail/indexView.vue')
  },

]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
